/*
 * @Author: your name
 * @Date: 2021-12-23 08:08:44
 * @LastEditTime: 2022-02-28 16:17:50
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue\vue-douban-pc\src\router\index.js
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/movies',
    name: 'Movies',
    component: () => import('../views/Movies.vue')
  },
  {
    path: '/movieshome',
    name: 'MoviesHome',
    component: () => import('../views/MoviesHome.vue')
  },
  {
    path: '/bookshome',
    name: 'BooksHome',
    component: () => import('../views/BooksHome.vue')
  },
  {
    path: '/books',
    name: 'Books',
    component: () => import('../views/Books.vue')
  },
  {
    path: '/movieplay/:id',
    name: 'MoviePlay',
    component: () => import('../views/MoviePlay.vue'),
    meta: {
      needLogin: true //需要加校检判断的路由
    },
  },
  {
    path: '/moviesplay/:id',
    name: 'MoviesPlay',
    component: () => import('../views/MoviesPlay.vue'),
    meta: {
      needLogin: true //需要加校检判断的路由
    },
  },
  {
    path: '/booksplay/:id',
    name: 'BooksPlay',
    component: () => import('../views/BooksPlay.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/forget',
    name: 'Forget',
    component: () => import('../views/Forget.vue')
  },
  {
    path: '/revise',
    name: 'Revise',
    component: () => import('../views/Revise.vue')
  },
  {
    path: '/userinfo',
    name: 'userInfo',
    component: () => import('../views/userInfo.vue'),
    children: [
      {
        path: '',
        name: 'Information',
        component: () => import('../views/Information.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'updateinfo',
        name: 'updateInfo',
        component: () => import('../views/updateInfo.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'pwupdate',
        name: 'pwUpdate',
        component: () => import('../views/pwUpdate.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'adminmovies',
        name: 'adminMovies',
        component: () => import('../views/adminMovies.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'adminbarrage',
        name: 'adminBarrage',
        component: () => import('../views/adminBarrage.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'admincomment',
        name: 'adminComment',
        component: () => import('../views/adminComment.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'adminuser',
        name: 'adminUser',
        component: () => import('../views/adminUser.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'sendingbarrage',
        name: 'sendingBarrage',
        component: () => import('../views/sendingBarrage.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
      {
        path: 'sendingcomment',
        name: 'sendingComment',
        component: () => import('../views/sendingComment.vue'),
        meta: {
          needLogin: true //需要加校检判断的路由
        },
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
